/******************************************************************************
//             INTEL CORPORATION PROPRIETARY INFORMATION
//  This software is supplied under the terms of a license agreement or
//  nondisclosure agreement with Intel Corporation and may not be copied
//  or disclosed except in accordance with the terms of that agreement.
//        Copyright (c) 2000 Intel Corporation. All Rights Reserved.
//
//  VSS: 
//     $Workfile: $
//     $Revision: $
//     $Date:     $
//     $Archive:  $
//
//  Description:
//      Intel(R) Integrated Performance Primitives - JPEG codec file.
//      This header file contains internal hufman encoding definitions.
//
//  History:
//     Date        Author        Changes
//     2000/5/14   Jerry Hu      Created  (Version 0.1)
//     2000/12/22  Jerry Hu      Modified (Version 0.2)
//
********************************************************************************/
#ifndef _IJEHUFSH_H
#define _IJEHUFSH_H

extern const Ipp8u _csizetable[];
extern const Ipp8u _eobsizetable[];

#define _MAXCORRBITS 1024

/* Get SSSS from size table */
#define _CSIZE(ssss, data)                        \
{                                                 \
    if (data<0) {                                 \
        if (data>-256) {                          \
            ssss = _csizetable[-data];            \
        } else {                                  \
            ssss = _csizetable[(-data) >> 8] + 8; \
        }                                         \
        data -= 1;                                \
    } else {                                      \
        if (data < 256) {                         \
            ssss = _csizetable[data];             \
        } else {                                  \
            ssss = _csizetable[data >> 8] + 8;    \
        }                                         \
    }                                             \
}

#define _EOBSIZE(ssss, data)                      \
{                                                 \
    if (data < 256) {                             \
        ssss = _eobsizetable[data];               \
    } else {                                      \
        ssss = _eobsizetable[data>>8]+8;          \
  }                                               \
}

void _IppWriteStreamBits(int    val, 
                      int    nbits, 
                      Ipp8u  *pBuffer, 
                      int    *curBitsLen);


#endif

/* EOF */
